# -*- coding:utf-8 -*-
from PySide6.QtWidgets import (QVBoxLayout, QHBoxLayout, QLineEdit, QPushButton, QGroupBox, QRadioButton)

from app.common.const_value import TargetLanguage

class ClientGroup(QGroupBox):
    def __init__(self):
        """
        client export路径设置
        """
        super().__init__("客户端导出设置")
        # 垂直布局
        client_export_layout_group = QVBoxLayout()   
        # 导类型选择
        client_export_type_layout = QHBoxLayout()
        # 创建多个复选框并添加到水平布局
        self.client_rbToJava = QRadioButton(TargetLanguage.JAVA.value)
        client_export_type_layout.addWidget(self.client_rbToJava)

        self.client_rbToGolang = QRadioButton(TargetLanguage.GO.value)
        client_export_type_layout.addWidget(self.client_rbToGolang)

        self.client_rbToCSharp = QRadioButton(TargetLanguage.CSHARP.value)
        client_export_type_layout.addWidget(self.client_rbToCSharp)
        # 加入到当前组件
        client_export_layout_group.addLayout(client_export_type_layout)

        # 导出路径选择
        client_export_path_layout = QHBoxLayout()
        # 创建路径选择所有的组件
        self.client_export_path_input = QLineEdit()
        self.client_export_path_input.setPlaceholderText("导出文件保存目录...")
        self.client_export_path_input.setReadOnly(True)
        client_export_path_layout.addWidget(self.client_export_path_input, 7)

        self.client_export_btn_choose = QPushButton("选择目录")
        client_export_path_layout.addWidget(self.client_export_btn_choose)

        client_export_layout_group.addLayout(client_export_path_layout)
        # 加入到当前组件
        self.setLayout(client_export_layout_group)

    def set_language(self, lang_data):
        """设置语言"""
        self.setTitle(lang_data.get("client_title", "客户端导出设置"))
        self.client_export_btn_choose.setText(lang_data.get("select_dir", "选择目录"))
        self.client_export_path_input.setPlaceholderText(lang_data.get("export_dir", "导出文件保存目录..."))